///mine.txt - An object that explodes whenever the pc gets close to it.
// Mine detonates itself if it receives the corrent message
//Cell 0 - The number of damage this mine does. If 0, defaults to 6.
//Cell 1 - Message which detonates mine
//  brown - 1, green - 2, red - 3

beginobjectscript; // mine

variables;
short r1;

body;

beginstate INIT_STATE;
	break;

beginstate DEAD_STATE;

break;

beginstate START_STATE;
	if ((my_current_message() == get_memory_cell(1)) || (dist_to_pc() <= 2)) {
		if (get_memory_cell(0) == 0)
			r1 = get_ran(6,1,6);
			else r1 = get_ran(get_memory_cell(0),1,6);
		pc_heard_sound(117);
		damage_nearby(r1,3,1,2);
		kill_object(ME,0);
		}
	if ((my_current_message() > 0) && (my_current_message() != get_memory_cell(1))) {
		print_str_color("The spores do not affect this mine. It's the wrong sort of baton.",2);
		}
break;

beginstate 3;
	
break;